home *** CD-ROM | disk | FTP | other *** search
- Path: henon.schap.rhno.columbia.edu!bdl6
- From: Bryan D. Lee <bdl6@columbia.edu>
- Newsgroups: comp.lang.c++
- Subject: Converting to ANSI Compliant Macro?
- Date: 2 Feb 1996 14:40:03 GMT
- Organization: Columbia University
- Distribution: world
- Message-ID: <4et7o3$or6@lol.cs.columbia.edu>
- NNTP-Posting-Host: henon.schap.rhno.columbia.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- X-Newsreader: Nuntius 2.0.4_68K
- X-XXMessage-ID: <AD378C6F0C01DE0F@henon.schap.rhno.columbia.edu>
- X-XXDate: Fri, 2 Feb 1996 14:39:59 GMT
-
- Hi,
-
- I have a set of macro's currently being used with AT&T CC (CFront) and
- I'm trying to port it to an ANSI-compliant compilier. Unfortunitaly, I
- don't know enough about macros to be able to make the change. Can anyone
- tell me what's wrong with them as they are and how I could either fix
- them or rewrite an equilivant macro?
-
- enum { BAD_STATUS = -1, GOOD_STATUS = 0 };
-
- # define PRINT(X) cerr << "( X ) = \"" << (X) << '"' << endl;
- # define ASSERT(X) { \
- if(!(X)) { cerr << "ERROR: assertion (X) failed at line " <<
- __LINE__ \
- << "." << endl; return BAD_STATUS; } \
- }
-
- # define EQ(X,Y) { \
- ostrstream buf; \
- buf << X << ends; \
- if(0 != strcmp(buf.str(), "Y")) { \
- cerr << "ERROR: assertion (" \
- << buf.str() << " == Y) failed at line " << __LINE__ \
- << "." << endl; return -1; \
- } \
- delete buf.str(); \
- }
-